package com.wuzf.mall.global

import android.content.Context
import com.blankj.utilcode.util.Utils
import com.wuzf.mall.config.Configuration

object Mall {

    private val configure = Configuration.instance

    fun init(context: Context): Configuration {
        // 初始化工具类
        // 对应于gradle中的 com.blankj:utilcode:1.21.2
        Utils.init(context)
        return configure.apply {
            setConfiguration(GlobalKeys.APPLICATION, context.applicationContext)
        }
    }

    fun <T> getConfiguration(key: String): T {
        return configure.getConfiguration<T>(key)
    }

    fun <T> getConfiguration(key: Enum<*>): T {
        return configure.getConfiguration<T>(key)
    }
}